package ThreadLocal;

import java.util.concurrent.TimeUnit;


/**
 * @功能
 * @创建时间 2019/12/20
 */
public class ThreadLocal1 {
    volatile static Person p = new Person();

    public static void main(String[] args) {
        new Thread(()->{
            try {
                TimeUnit.SECONDS.sleep(2);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(p.name);
        }).start();
        new Thread(()->{
            try{
                TimeUnit.SECONDS.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            p.name="list1";
        }).start();
    }

}
class Person{
    String name = "zhangsan";
}